package cn.lijiajia3515.cairo.auth.modules.role;

import cn.lijiajia3515.cairo.core.business.DefaultBusiness;
import cn.lijiajia3515.cairo.core.exception.BusinessException;
import cn.lijiajia3515.cairo.core.page.Page;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RoleClientFallbackFactory implements FallbackFactory<RoleClient> {
	@Override
	public RoleClient create(Throwable cause) {
		return new RoleClient() {
			@Override
			public List<Role> find(FindRoleParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}

			@Override
			public Page<Role> findPage(FindRoleParam param) {
				throw new BusinessException("调用失败", cause, DefaultBusiness.Failed);
			}
		};
	}
}
